<?php if (!defined('THINK_PATH')) exit();?>
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>原一科技后台 - 登录</title>
    <link href="/Public/Admin/css/bootstrap.min.css?v=1.0" rel="stylesheet">
    <link href="/Public/Admin/font-awesome/css/font-awesome.css?v=1.0" rel="stylesheet">
    <link href="/Public/Admin/css/style.min.css?v=1.0" rel="stylesheet">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html"/><![endif]-->
    <script>if (window.top !== window.self) {
        window.top.location = window.location;
    }</script>
    <style>
        .middle-box h1 {
            font-size: 40px;
        }
        .logo-name {
            color: #e6e6e6;
            font-size: 180px;
            font-weight: 800;
            letter-spacing: 10px;
            margin-bottom: 40px;
        }
        .middle-box {
            max-width: 400px;
            z-index: 100;
            margin: 0 auto;
            padding-top: 100px;
        }
    </style>
</head>

<body class="gray-bg">

<div class="middle-box text-center loginscreen  animated fadeInDown">
    <div>
        <div>

            <h1 class="logo-name">原一科技</h1>

        </div>


        <form class="m-t" role="form" action="index.html">
            <div class="form-group">
                <input type="username" class="form-control" id="username" placeholder="用户名" required="">
            </div>
            <div class="form-group">
                <input type="password" class="form-control" id="password" placeholder="密码" required="">
            </div>
            <button type="button" class="btn btn-primary block full-width m-b" onclick="login()">登 录</button>

        </form>
    </div>
</div>
<script src="/Public/Admin/js/jquery.min.js?v=1.0"></script>
<script src="/Public/Admin/js/bootstrap.min.js?v=1.0"></script>
<script src="/Public/Admin/js/jQuery.md5.js?v=1.0"></script>
<script src="/Public/Admin/js/plugins/layer/layer.js?v=1.0"></script>
<script>
var lock = 0;

function login()
{
    var json_data               = {};
        json_data['username']   = $("#username").val();
        json_data['password']   = $("#password").val();

        if (!json_data['username']) 
        {
            layer.msg('请输入账号', {icon: 2});
            return false;
        }

        if (!json_data['password']) 
        {
            layer.msg('请输入密码', {icon: 2});
            return false;
        }

        json_data['password']   =   $.md5(json_data['password']);

    if (lock > 0) { return false;}

    var request_url = "<?php  echo U('base/logindo'); ?>";
    var login_url = "<?php  echo U('Index/index'); ?>";
    $.ajax({
        type : 'post',
        url  : request_url+'?t='+Math.random(),
        data : json_data,
        dataType : 'json',
        beforeSend: function(){
            lock = 1;
        },
        success : function(res){
            lock = 0;
            if(res.state > 0){
              layer.msg('登陆成功', {icon: 1});
               window.location.href =  login_url;
            }else{
                layer.msg(res.error, {icon: 2});        
            }
        },
        complete: function(){
            
        },
        error : function(XMLHttpRequest, textStatus, errorThrown) {
            layer.msg('网络失败，请刷新页面后重试', {icon: 2});
        }
    })          

}
</script>

</body>

</html>